Java code to find the element that appears once in a sorted array